package com.lxm.ymcc.service.impl;

import com.lxm.ymcc.service.ITokenService;
import com.lxm.ymcc.util.StrUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

@Service
public class TokenServiceImpl implements ITokenService {

   @Autowired
   private RedisTemplate<Object,Object> redisTemplate;


    @Override
    public String createTokenForOrder(String ids) {
        // 生成一个token uuid 工具类生成
        String token = StrUtils.getComplexRandomString(10);
        // 获取当前登录用户
        Long loginId = 3l;
        // 将token 存放到redis中
        redisTemplate.opsForValue().set(loginId+":"+ids,token);

        return token;
    }
}
